(global.webpackJsonp = global.webpackJsonp || []).push([ [ "punchcard/index" ], {
    4105: function(t, i, e) {
        e.d(i, "b", function() {
            return o;
        }), e.d(i, "c", function() {
            return n;
        }), e.d(i, "a", function() {});
        var o = function() {
            var t = this, i = (t.$createElement, t._self._c, parseInt(t.info.text_limit)), e = parseInt(t.info.img_limit), o = parseInt(t.info.audio_limit), n = parseInt(t.info.video_limit), a = 0 == parseInt(t.info.video_limit) && 0 == parseInt(t.info.img_limit), r = t.$root.m4 && 0 == parseInt(t.info.audio_limit), c = t.$root.m5 && 0 == parseInt(t.info.video_limit);
            t.$mp.data = Object.assign({}, {
                $root: {
                    m0: i,
                    m1: e,
                    m2: o,
                    m3: n,
                    m4: a,
                    m5: r,
                    m6: c
                }
            });
        }, n = [];
    },
    "523a": function(t, i, e) {
        var o = e("9411");
        e.n(o).a;
    },
    "79d2": function(t, i, e) {
        (function(t) {
            Object.defineProperty(i, "__esModule", {
                value: !0
            }), i.default = void 0;
            var o = d(e("03b8")), n = d(e("acb5")), a = (e("7a6d"), e("bc33")), r = e("10aa"), c = e("8434"), u = (e("a71e"), 
            e("db8f")), s = (d(e("801c")), e("26cb"));
            function d(t) {
                return t && t.__esModule ? t : {
                    default: t
                };
            }
            function l(t) {
                return function(t) {
                    if (Array.isArray(t)) return h(t);
                }(t) || function(t) {
                    if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) return Array.from(t);
                }(t) || function(t, i) {
                    if (t) {
                        if ("string" == typeof t) return h(t, i);
                        var e = Object.prototype.toString.call(t).slice(8, -1);
                        return "Object" === e && t.constructor && (e = t.constructor.name), "Map" === e || "Set" === e ? Array.from(t) : "Arguments" === e || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? h(t, i) : void 0;
                    }
                }(t) || function() {
                    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
                }();
            }
            function h(t, i) {
                (null == i || i > t.length) && (i = t.length);
                for (var e = 0, o = new Array(i); e < i; e++) o[e] = t[e];
                return o;
            }
            function f(t, i) {
                var e = Object.keys(t);
                if (Object.getOwnPropertySymbols) {
                    var o = Object.getOwnPropertySymbols(t);
                    i && (o = o.filter(function(i) {
                        return Object.getOwnPropertyDescriptor(t, i).enumerable;
                    })), e.push.apply(e, o);
                }
                return e;
            }
            function p(t, i, e) {
                return i in t ? Object.defineProperty(t, i, {
                    value: e,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : t[i] = e, t;
            }
            var m = t.getRecorderManager(), v = t.createInnerAudioContext();
            v.autoplay = !0;
            var b = {
                components: {},
                computed: function(t) {
                    for (var i = 1; i < arguments.length; i++) {
                        var e = null != arguments[i] ? arguments[i] : {};
                        i % 2 ? f(Object(e), !0).forEach(function(i) {
                            p(t, i, e[i]);
                        }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(e)) : f(Object(e)).forEach(function(i) {
                            Object.defineProperty(t, i, Object.getOwnPropertyDescriptor(e, i));
                        });
                    }
                    return t;
                }({}, (0, s.mapGetters)([ "configs", "user", "mainColor", "iphoneXStyle", "priceColor" ])),
                data: function() {
                    return {
                        data: [ {
                            class: "iconyuyin"
                        }, {
                            class: "iconrecord-video"
                        }, {
                            class: "icontupian"
                        } ],
                        fileMedio: [],
                        files: [],
                        infos: {
                            title: "第一天",
                            text: ""
                        },
                        url: "",
                        isShow: !1,
                        bgColor: "",
                        isLive: !1,
                        info: "",
                        rec: "",
                        voicePath: "",
                        videoPath: "",
                        video_duration: "",
                        voice_duration: "",
                        blobs: "",
                        blob: "",
                        time: "",
                        type: "",
                        isPlay: !1,
                        audio: "",
                        video_weight: "",
                        video_height: "",
                        audio_durition: 0,
                        subtxt: "确认提交",
                        timeDurition: "",
                        animateColor: "",
                        punchcard_number: "",
                        punchcard_title: "恭喜您获得打卡积分奖励"
                    };
                },
                created: function() {},
                onLoad: function(t) {
                    var i = this;
                    i.animateColor = (0, u.colorRgba)(i.mainColor, .5), this.puchcardId = t.puchcardId, 
                    this.time = t.time, this.type = t.type, i.info = JSON.parse(t.info), this.recOpen(), 
                    m.onStop(function(t) {
                        console.log("res1", t), i.fileMedio.map(function(t, e) {
                            "audio" == t.type && i.del("audio", e);
                        }), i.fileMedio.push({
                            type: "audio",
                            url: t.tempFilePath
                        }), i.voicePath = t.tempFilePath, i.voice_duration = Math.ceil(parseInt(t.duration) / 1e3) + '"', 
                        i.audio_durition = Math.ceil(parseInt(t.duration) / 1e3);
                    }), v.onEnded(function(t) {
                        i.isPlay = !1;
                    });
                },
                onUnload: function() {},
                methods: {
                    hide: function() {
                        (0, c.route)({
                            url: "/punchcard/punchcard",
                            type: 3,
                            data: {
                                id: this.puchcardId
                            }
                        });
                    },
                    submit: function() {
                        var i = this, e = this;
                        return "提交中" != e.subtxt && (0 != this.info.text_limit && this.infos.text.length < this.info.text_limit ? (this.$toast("日记文字最少为" + this.info.text_limit + "个字", "none"), 
                        !1) : 0 != this.info.img_limit && this.files.length < this.info.img_limit ? (this.$toast("日记图片最少为" + this.info.img_limit + "张图", "none"), 
                        !1) : 0 != this.info.video_limit && this.video_duration < this.info.video_limit ? (this.$toast("日记视频时长最少为" + this.info.video_limit + "秒", "none"), 
                        !1) : 0 != this.info.audio_limit && this.audio_durition < this.info.audio_limit ? (this.$toast("日记录音时长最少为" + this.info.audio_limit + "秒", "none"), 
                        !1) : (t.showLoading({
                            title: "加载中"
                        }), this.files.length > 0 ? (0, r.uploadSlgnImage)(2, this.files).then(function(t) {
                            i.files = t, e.uploadVideo();
                        }) : e.uploadVideo(), void (e.subtxt = "提交中")));
                    },
                    uploadVideo: function() {
                        var t = this;
                        "" != t.voicePath && "" == t.videoPath ? t.upload("audio", t.voicePath).then(function(i) {
                            t.voicePath = i, t.putPunchcard();
                        }) : "" == t.voicePath && "" != t.videoPath ? t.upload("video", t.videoPath).then(function(i) {
                            t.videoPath = i, t.putPunchcard();
                        }) : "" != t.voicePath && "" != t.videoPath ? t.upload("video", t.videoPath).then(function(i) {
                            t.videoPath = i, t.upload("audio", t.voicePath).then(function(i) {
                                t.voicePath = i, t.putPunchcard();
                            });
                        }) : t.putPunchcard();
                    },
                    putPunchcard: function() {
                        var i = this, e = this;
                        t.hideLoading();
                        var o = {
                            punchcard_id: this.puchcardId,
                            type: this.type,
                            content: this.infos.text,
                            video: this.videoPath,
                            audio: this.voicePath,
                            imglist: this.files.join(","),
                            true_time: this.time,
                            video_weight: this.video_weight,
                            video_height: this.video_height,
                            audio_durition: this.audio_durition
                        };
                        (0, a.punchcard)(o).then(function(o) {
                            t.showToast({
                                icon: "none",
                                title: "打卡成功",
                                duration: 1e3
                            }), e.subtxt = "确认提交", 1 == o.jf_reward ? (e.punchcard_number = o.jf_number, e.$refs.model.openModel()) : (0, 
                            c.route)({
                                url: "/punchcard/punchcard",
                                type: 3,
                                data: {
                                    id: i.puchcardId
                                }
                            });
                        });
                    },
                    confirm: function() {
                        (0, c.route)({
                            url: "/punchcard/punchcard",
                            type: 3,
                            data: {
                                id: this.puchcardId
                            }
                        });
                    },
                    del: function(t, i) {
                        "video" == t ? this.videoPath = "" : this.voicePath = "", this.fileMedio.splice(i, 1);
                    },
                    delImg: function(t) {
                        this.files.splice(t, 1);
                    },
                    putlive: function() {
                        this.isLive = !this.isLive, this.isLive ? this.startRecord() : this.endRecord();
                    },
                    open: function(t) {
                        switch (t) {
                          case 0:
                            this.isShow = !0, this.stopVoice();
                            break;

                          case 1:
                            this.chooseVideo();
                            break;

                          case 2:
                            this.chooseImg();
                        }
                    },
                    close: function() {
                        this.isShow = !1;
                    },
                    discard: function() {},
                    recOpen: function() {},
                    startRecord: function() {
                        m.start();
                    },
                    endRecord: function() {
                        m.stop(), this.close();
                    },
                    stopVoice: function() {
                        v.stop();
                    },
                    playVoice: function() {
                        var t = this;
                        if (t.isPlay) return t.isPlay = !t.isPlay, t.stopVoice(), !1;
                        t.isPlay = !t.isPlay, v.src = t.voicePath, v.play();
                    },
                    chooseImg: function() {
                        var i = this;
                        if (this.files.length >= 9) return t.showToast({
                            icon: "none",
                            title: "图片上传最多为9张",
                            duration: 1e3
                        }), !1;
                        var e = 9 - this.files.length;
                        t.chooseImage({
                            count: e,
                            sizeType: [ "original", "compressed" ],
                            sourceType: [ "album" ],
                            success: function(t) {
                                i.files = [].concat(l(i.files), l(t.tempFilePaths));
                            }
                        });
                    },
                    chooseVideo: function() {
                        var i = this;
                        t.chooseVideo({
                            sourceType: [ "camera", "album" ],
                            success: function(t) {
                                i.fileMedio.map(function(t, e) {
                                    "video" == t.type && i.del("video", e);
                                }), i.fileMedio.push({
                                    type: "video",
                                    url: t.tempFilePath
                                }), i.video_duration = t.duration.toFixed(2), i.videoPath = t.tempFilePath, i.video_weight = t.width, 
                                i.video_height = t.height;
                            }
                        });
                    },
                    upload: function(i, e) {
                        var a = {};
                        return "audio" == i && (a = {
                            i: o.default.uniacid,
                            file_type: "audio"
                        }), new Promise(function(i, o) {
                            t.uploadFile({
                                url: n.default.upImg,
                                filePath: e,
                                header: {
                                    "Content-Type": "multipart/form-data"
                                },
                                name: "file",
                                formData: a,
                                success: function(t) {
                                    i(JSON.parse(t.data).data);
                                },
                                fail: function(t) {
                                    o(), console.log(t);
                                }
                            });
                        });
                    }
                }
            };
            i.default = b;
        }).call(this, e("543d").default);
    },
    "804e": function(t, i, e) {
        e.r(i);
        var o = e("4105"), n = e("b499");
        for (var a in n) "default" !== a && function(t) {
            e.d(i, t, function() {
                return n[t];
            });
        }(a);
        e("523a");
        var r = e("f0c5"), c = Object(r.a)(n.default, o.b, o.c, !1, null, "702ef231", null, !1, o.a, void 0);
        i.default = c.exports;
    },
    9411: function(t, i, e) {},
    b499: function(t, i, e) {
        e.r(i);
        var o = e("79d2"), n = e.n(o);
        for (var a in o) "default" !== a && function(t) {
            e.d(i, t, function() {
                return o[t];
            });
        }(a);
        i.default = n.a;
    },
    f522: function(t, i, e) {
        (function(t) {
            e("1067"), o(e("66fd"));
            var i = o(e("804e"));
            function o(t) {
                return t && t.__esModule ? t : {
                    default: t
                };
            }
            wx.__webpack_require_UNI_MP_PLUGIN__ = e, t(i.default);
        }).call(this, e("543d").createPage);
    }
}, [ [ "f522", "common/runtime", "common/vendor" ] ] ]);